<template>
  <view class="container">
    <rich-text class="rich" :nodes="node"></rich-text>
  </view>
</template>

<script>
import { getConfig, updateConfig } from "../../api/active"
export default {
  data() {
    return {
      node: "",
      text: {
        1: "富侨用户协议",
        2: "隐私协议",
        3: "支付协议",
        4: "会员计划"
      },
      keyData: {
        1: "USER_AGREE",
        2: "USER_SECRET_POLICY",
        3: "USER_PAY_POLICY",
        4: "USER_MEMBER_PLAN"
      }
    }
  },
  onLoad(e) {
    uni.setNavigationBarTitle({
      title: this.text[e.title]
    })
    // this.update()
    // setTimeout(() => {
      this.getConfigData(e.title)
    // }, 1000)
  },
  methods: {
    getConfigData(num) {
      getConfig({
        key: this.keyData[num]
      }).then(res => {
        this.node = res.data
      })
    },
    update() {
      updateConfig({
        key: "USER_MEMBER_PLAN",
        val: ``
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  padding: 30rpx;
  width: 100vw;
  min-height: 100vh;
}

.rich {
  // font-size: 28rpx;
  color: #333;
}
</style>
